<?php $arr=$this->get('documents');?>
	<form method="post" onsubmit="return ajax_form(this)" action="<?php _e($this->module)?>/Index/delete" id="frm">
		<div class="x-list-title">
			<table width="100%" border="0" height="100%">
				<tr>
					<td align="left">
						<h2>
							<?php
								_e($this->get('x_title'));
							?>
						</h2>
					</td>
					<td align="right">	
						<div class="x-list-options">
							
							<a href="#Document/index/add" class="x-button">Thêm tài liệu chung</a>
							<div class="x-options-container">
								<a class="x-button"> Tác vụ khác <span class="x-tri">&#9660;</span></a>
								<div class="x-options">
									<input type="submit" value="Xóa tài liệu" class="x-options-item x-track" />
									<a href="#Document/Indexp/add" class="x-options-item x-track">Thêm tài liệu cá nhân</a>
								</div>
							</div>
							
						</div>
					</td>
				</tr>
			</table>	
		</div>
		<table width="100%" cellpadding="7" class="x-list" >
			<?php $vars = $this->get('vars');?>
			<tr>
				<th width="25" align="center">TT</th>
				
				<th width="200">
					<?php show_order_link('Tên tài liệu','title','#Document',$vars) ;?>
				</th>
				<th >
				<?php show_order_link('Nội dung','content','#Document',$vars) ;?>
				</th>
				
				<th width="100">
					<?php show_order_link('Ngày tạo','date_created','#Document',$vars) ;?>
				</th>
				<th width="80">
				<?php show_order_link('Người tạo','created_by_id','#Document',$vars) ;?>
					
				</th>
				<th width="25">
				<?php show_order_link('FILE','filename','#Document',$vars) ;?>
				</th>
				<th width="25" colspan="2">Tác vụ</th>
				
				<th align="center" width="25">
						<div class="x-check-container">
							<div class="x-check">
							<input type="checkbox" id="diploma_check_all" class="x-checkbox x-checkall"/>
							</div>
							<div class="x-check-options">
								<a class="x-check-item" onclick="diploma_checkall()">Chọn tất cả</a>
								<a class="x-check-item" onclick="diploma_uncheckall()">Bỏ chọn tất cả</a>
							</div>
						</div>
				</th>
			</tr>
			<?php
			if(count($arr)==0){
				_e("<tr><td class='page' colspan='9'><div class='x-page'>Chưa có tài liệu nào được tạo .</div></td></tr>");
			}else{
				foreach( $arr as $k=>$a ){?>
				<tr>
					<td align="center" width="25"><?php echo $k+1;?></td>
					<td><a href="#Document/Index/View?ID=<?php echo $a['ID'];?>"><?php _e(short_title($a['title'],40));?></a></td>
					
					<td ><?php _e(short_title($a['content'], 50));?></td>
					<td align="center" width="100"><?php _e(show_date(DATE_FORMAT,$a['date_created']));?></td>
					<td align="center" width="60">
						<a class="userlink username" href="#User/Info?ID=<?php _e($a['created_by_id'])?>"> <?php _e($a['username'])?></a>
					</td>
					<td align="center"><a class="x-downloader" href="<?php _baseUrl()?>/Document/Index/download?ID=<?php _e($a["ID"])?>"> . zip </a></td>
					<td width="25" align="center">
						<?php if($this->get('user_id')==$a['created_by_id']){?>
						<a href="#Document/Index/edit?ID=<?php _e($a['ID']);?>" class="x-edit"></a>
						<?php }else{?>
						<a class="x-noedit"></a>
						<?php }?>
					</td>
					<td width="25" align="center">
						<?php if($this->get('user_id')==$a['created_by_id']){?>
						<a onclick="module_delete('<?php _baseUrl()?>/Document/Index/delete?ID=<?php _e($a['ID']);?>')" class="<?php $this->get('user_id')==$a['created_by_id']?_e("x-delete"):_e("x-nodelete")?>"></a>
						<?php }else{?>
							<a class="x-nodelete"></a>
						<?php }?>
					</td>
					<td width="25" align="center"><input value="<?php _e($a['ID']);?>" type="checkbox" name="checkbox_diploma[]"/></td>
				</tr>
				<?php }
				?>
				<tr>
					<td colspan="9" class="page">
						<div class="x-page">
							<?php $this->e("page");?>
						</div>		
					</td>
				</tr>
				<?php
			}
			?>
		</table>
	</form>
